import 'package:flutter_taotaoshipin/generated/json/base/json_convert_content.dart';
import 'package:flutter_taotaoshipin/model/ad_ver_type_entity.dart';

AdVerTypeEntity $AdVerTypeEntityFromJson(Map<String, dynamic> json) {
  final AdVerTypeEntity adVerTypeEntity = AdVerTypeEntity();
  final String? ver = jsonConvert.convert<String>(json['ver']);
  if (ver != null) {
    adVerTypeEntity.ver = ver;
  }
  final int? adverType = jsonConvert.convert<int>(json['adver_type']);
  if (adverType != null) {
    adVerTypeEntity.adverType = adverType;
  }
  final String? imageUrl = jsonConvert.convert<String>(json['image_url']);
  if (imageUrl != null) {
    adVerTypeEntity.imageUrl = imageUrl;
  }
  final String? promotionUrl = jsonConvert.convert<String>(
      json['promotion_url']);
  if (promotionUrl != null) {
    adVerTypeEntity.promotionUrl = promotionUrl;
  }
  final String? isCsj = jsonConvert.convert<String>(json['is_csj']);
  if (isCsj != null) {
    adVerTypeEntity.isCsj = isCsj;
  }
  final String? amount = jsonConvert.convert<String>(json['amount']);
  if (amount != null) {
    adVerTypeEntity.amount = amount;
  }
  return adVerTypeEntity;
}

Map<String, dynamic> $AdVerTypeEntityToJson(AdVerTypeEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['ver'] = entity.ver;
  data['adver_type'] = entity.adverType;
  data['image_url'] = entity.imageUrl;
  data['promotion_url'] = entity.promotionUrl;
  data['is_csj'] = entity.isCsj;
  data['amount'] = entity.amount;
  return data;
}

extension AdVerTypeEntityExtension on AdVerTypeEntity {
  AdVerTypeEntity copyWith({
    String? ver,
    int? adverType,
    String? imageUrl,
    String? promotionUrl,
    String? isCsj,
    String? amount,
  }) {
    return AdVerTypeEntity()
      ..ver = ver ?? this.ver
      ..adverType = adverType ?? this.adverType
      ..imageUrl = imageUrl ?? this.imageUrl
      ..promotionUrl = promotionUrl ?? this.promotionUrl
      ..isCsj = isCsj ?? this.isCsj
      ..amount = amount ?? this.amount;
  }
}